<template>
  <div>
    <!-- 商品详情 -->
    <img :src="goods.img1" class="img" />
    <p>商品名称：{{goods.proname}}</p>
    <p>商品价格：{{goods.originprice}}</p>
    <p>商品品牌：{{goods.brand}}</p>
    <hr/>
    <!-- 评论 -->
    <!-- <ul>
        <li v-for="item in comments" :key="item.id">
            <p>评论内容：{{item.content}}</p>
            <p>评论时间：{{item.time}}</p>
            <p>评论人：{{item.username}}</p>
        </li> 
    </ul> -->
  </div>    
</template>

<script>

export default {
    name:"GoodsDetail",
    props:["proid"],
    data(){
        return {
            goods:{},
            comments:[]
        }
    },
    created(){
        console.log("this.$route",this.$route);
        // 问后端要商品的详情数据
        this.$http({
            // url:"/api/pro/detail/"+this.$route.params.proid
            url:"/api/pro/detail/"+this.proid
        })
        .then(res=>{
            if(res.data.code=="200"){
                this.goods = res.data.data;
            }
        })

    }
}
</script>

<style scoped>
.img{
    width: 100%;
}

</style>